package com.witsight.platform.adapter;

import javax.xml.bind.annotation.adapters.XmlAdapter;

import com.witsight.platform.util.lang.ClassUtil;

/**   
 * 说明：String 和 Class的回想转换
 * @Title: ClassStringAdapter.java 
 * @Package com.witsight.cassandra.adapter 
 * @See: {@link XmlAdapter}
 * Copyright: Copyright (c) 2017
 * Company:sany huax witsight team by product
 * @author: penght  
 * @date: 2017年9月21日 上午8:13:28 
 * @version: V1.0
 *
 */
public class ClassStringAdapter extends XmlAdapter<String,Class<?>>{

	@Override
	public Class<?> unmarshal(String v) throws Exception {
		return ClassUtil.getClass(v, true);
	}

	@Override
	public String marshal(Class<?> clazz) throws Exception {
		if (clazz == null) {
			return null;
		}
		return clazz.getName();
	}
}
